<%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" 	uri="http://java.sun.com/jsp/jstl/functions"%>
<!doctype html>
<html lang="ko">
<head> 
<meta charset=utf-8>
<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>My ALIMI</title>
<link rel="stylesheet" type="text/css" href="${contextPath}/css/alimiButton.css" />
<link rel="stylesheet" type="text/css" href="${contextPath}/css/alimiTab.css" /> 
<link rel="stylesheet" type="text/css" href="${contextPath}/css/w.css" />
<link rel="stylesheet" type="text/css" href="${contextPath}/css/e.css" />
<script type="text/javascript" src="${contextPath}/js/libs/jindo.mobile.all.ns.js"></script> 
</head> 
<body class="">
<form id="contentsForm" name="contentsForm" action="/alimi/keyword/get.alm">
<input type="hidden" id="contentKey" name="contentKey"/>
<input type="hidden" id="keyword" name="keyword"/>
<div class="headerTitle">
	<div class="nv1">
		<span>MY ALIMI - ${keyword}  </span>
	</div>
</div> 

<div>
	<ul class="tabmenu3">
		<li class="on"><a href="#">새소식들</a></li>
		<li><a href="/alimi/contents/getUser.alm?keyword=${keyword}">내소식들</a></li>
	</ul>
</div>

<div class="sign-in">
	<input type="submit" class="g-button g-button-submit" value="키워드 페이지로 이동">
</div>

<div id="ct">
	<ul class="li1">
	<c:forEach var="newContent" items="${newContents}">
	<c:if test="${newContent.addYn eq 'N' }">
	<li>
	<span class="ct"><span class="wn l2"><span class="elip"><span class="elip in">
		<a href="#none" id="title_${newContent.contentKey}" class="elip_title newTitle">${newContent.title} </a>
		<img class="ic3" src="/img/icon_new.png"></img>
		<input type="button" value="추가" onclick="contents.newlist.save(${newContent.contentKey}, '${keyword}')">
	</span></span></span></span>
	</li>
	<li id="newSummary_${newContent.contentKey}" style="display:none"><a href=${newContent.url } class="ct">${newContent.summary }</a> </li>
	</c:if>
	</c:forEach>
	</ul>
</div>

<hr />
<div class="u_ft"></div>
</form>
<script type="text/javascript">
if (typeof contents == 'undefined') { contents = {}; }
contents.newlist = {
	_aNewTitle : null,
	_aSave : null,
	
	init : function () {
		this._aNewTitle =  jindo.$A(jindo.$$("a.newTitle"));
		this._aSave =  jindo.$A(jindo.$$("a.save"));
		
		jindo.$Fn(function(e) {
			var titleId = jindo.$Event(e).currentElement.id;
			var count = titleId.split('_')[1];
			var summaryId = 'newSummary_' + count;
			if (jindo.$(summaryId).style.display == 'none') {
				jindo.$(summaryId).style.display='';
			} else  {
				jindo.$(summaryId).style.display='none';
			}
			
		}).attach(this._aNewTitle, "click");
		
	},
	
	save : function (contentKey, keyword) {
		jindo.$Form("contentsForm").value("keyword", keyword);
		jindo.$Form("contentsForm").value("contentKey", contentKey);
		jindo.$Form("contentsForm").$value().action="/alimi/contents/save.alm";
		jindo.$Form("contentsForm").submit();
	}
	
}

window.onload = function() {
	contents.newlist.init();
}
</script>

</body>
</html>
